package com.haidechizi.doublecache.service;

import com.haidechizi.doublecache.cachemanager.MemoryCacheManager;

public class DefaultLocalCacheService implements LocalCacheService {

    private final MemoryCacheManager<Object> cacheManager = new MemoryCacheManager<>();

    @Override
    public void setCache(String cacheKey, Object value, int timeout) {
        cacheManager.set(cacheKey, value, timeout);
    }

    @Override
    public Object getCache(String cacheKey) {
        return cacheManager.get(cacheKey);
    }

    @Override
    public void deleteCache(String cacheKey) {
        cacheManager.removeCache(cacheKey);
    }
}
